#!/usr/bin/python

__author__  = "author"
__mail__    = "mail"
__version__ = (0,0,1)

"""
  Insert program explanation here
"""
import re

def seq_or(sequence, item):
    for element in sequence:
        match = element.match(item)
        if match != None:
            return True
    return False

def seq_and(sequence, item):
    for element in sequence:
        match = element.match(item)
        if match == None:
            return False
    return True

"""
  call this function from other modules
  argv
"""
def execute(patterns, candidates):
    seq = []
    for p in patterns:
        seq.append(re.compile(p))
    for c in candidates:
        print 'OR    %s: %d' % (c, seq_or(seq, c))
        print 'AND   %s: %d' % (c, seq_and(seq, c))
    
import sys

if __name__ == "__main__":
   execute(['.*google.*', '.*yahoo.*'], ['http://www.unp.edu.ar', 'http://www.google.com', 'http://ar.yahoo.com'])
